import os

def read_directory(directorytxt):
    """[summary]

    Args:
        directorytxt (path): labelpath

    Returns:
        res: strint of labels
    """
    res = ''
    with open(directorytxt, 'r') as f:
        lines = f.readlines()
        for line in lines:
            line = line.strip('\n')
            twopart = line.split('\t')
            if len(twopart) !=2: continue
            if twopart[0]== '<eol>' or twopart[0] == '<sos>': continue
            res += twopart[0]
    return res

if __name__ == "__main__":
    labels = read_directory('dictionary_all61.txt')
    print(len(labels),'labels:',labels)